Skip to content

fix(quota): reject out-of-range reset times - #9033

Merged
developing-today[bot] merged 1 commit into
mainfrom
queue/15311-9003-monthdaytime
Nov 12, 2026
Merged

developing-today[bot] merged 1 commit into
mainfrom
queue/15311-9003-monthdaytime

Conversation

@dezren39

@dezren39 dezren39 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Reject invalid hour/minute components before Date.UTC normalizes provider reset times.
  • Cover minute 60/99 and hour 24 failures plus valid 23:59 across Codex, OpenCode Go, and Command Code extractors.
  • Preserve percentage windows and existing date roll-forward behavior.

Fixes #9003

Verification

  • bun test test/quota.test.ts (pm-stack/aggregator): 31 pass.
  • git diff --check: pass.
  • Full aggregator suite attempted; environment lacks web-push in this worktree and unrelated tests failed/timed out.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Invalid quota reset times are now rejected, including hours above 23 and minutes above 59. Valid reset times, including 23:59, continue to produce the expected UTC reset timestamp.
    • Month-based quota resets now handle month names regardless of capitalization and reject invalid month names or dates.

@dezren39
dezren39 requested a review from a team as a code owner November 12, 2026 21:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T21:11:39.772859Z 9b9c5cb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The monthly quota reset parser now rejects non-integer or out-of-range hours and minutes. Tests cover valid and invalid reset times across ChatGPT, OpenCode Go, and Command Code.

Changes: Quota reset time validation

Layer / File(s) Summary
Validate monthly reset times
pm-stack/aggregator/src/quota-extract.ts, pm-stack/aggregator/test/quota.test.ts
monthDayTime returns null for invalid hours or minutes. Tests cover out-of-range values, the valid 23:59 boundary, and existing quota windows across the three consumers.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to 9b9c5

Quota reset times with out-of-range hours or minutes are now rejected instead of being silently rolled into a different time. Valid times are unchanged, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(quota): reject out-of-range reset times" names the main change. The raw summary and objectives confirm that monthDayTime now returns null for hours above 23 or minutes above 59, with re…
Linked Issues check Passed Issue #9003 requires monthDayTime to return null for out-of-range time-of-day values (hour > 23 or minute > 59) at all three call sites (Codex, OpenCode Go, Command Code), while keeping the window per…
Out of Scope Changes check Passed Both changed files are in scope. The source change is a single validation guard inside monthDayTime, which is the function named in #9003. No other extractor logic or parsing regex is modified. The te…
Full details: Title check

Explanation

The title "fix(quota): reject out-of-range reset times" names the main change. The raw summary and objectives confirm that monthDayTime now returns null for hours above 23 or minutes above 59, with regression tests for those cases. The title is specific and short, and it matches the changeset.

Full details: Linked Issues check

Explanation

Issue #9003 requires monthDayTime to return null for out-of-range time-of-day values (hour > 23 or minute > 59) at all three call sites (Codex, OpenCode Go, Command Code), while keeping the window percentage and other fields. The diff adds one guard in monthDayTime in pm-stack/aggregator/src/quota-extract.ts, after the hh:mm split and before Date.UTC: if (!Number.isInteger(h) || h < 0 || h > 23 || !Number.isInteger(m) || m < 0 || m > 59) return null;. Because all three extractors call this shared function, the guard covers each call site. The guard runs before the date construction, so minute 60 and 99 (no midnight rollover) and hour 24 are rejected directly, not only by the day-roll side effect. Regression tests in pm-stack/aggregator/test/quota.test.ts run the existing three-consumer matrix and add cases for 18:60 (null), 18:99 (null), 24:00 (null), and 23:59 (expected 2026-10-30T23:59:00.000Z). The existing month-case, Foo 30, and Oct 39 cases remain in the matrix, and the 18:01 control is kept. The issue's acceptance criteria are covered by this change.

Full details: Out of Scope Changes check

Explanation

Both changed files are in scope. The source change is a single validation guard inside monthDayTime, which is the function named in #9003. No other extractor logic or parsing regex is modified. The test changes parameterize the existing consumer matrix with a time field and add the invalid and boundary time cases required by #9003. The test file diff contains no unrelated changes. The guard is only a validation addition, so the valid-time, month-case, unknown-month, out-of-range-day, and roll-forward paths are unchanged in behavior. Existing test results are taken from the PR description; this assessment did not run the tests.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96f84231-ef36-4bed-aeff-f3e389290281
Commits

Reviewing files that changed from the base of the PR and between 8064969 and 9b9c5cb.

Files selected for processing: 2

  • pm-stack/aggregator/src/quota-extract.ts
  • pm-stack/aggregator/test/quota.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@developing-today
developing-today Bot merged commit 3119cd2 into main Nov 12, 2026
13 of 19 checks passed
@developing-today
developing-today Bot deleted the queue/15311-9003-monthdaytime branch November 12, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aggregator(quota-extract): monthDayTime accepts out-of-range minutes — 'Oct 30, 18:99 UTC' becomes a fabricated 19:39 resetsAt instead of null

1 participant